package com.autumn.platform.auth.core.authc;

import com.autumn.platform.auth.core.authc.impl.AuthenticationContext;

public interface IAuthenticationListener {

    /**
     * 认证之前触发
     * 
     * @param authenticationToken 认证token
     */
    default void before(IAuthenticationToken authenticationToken) {}

    /**
     * 认证成功触发
     * 
     * @param authenticationToken 认证token
     * @param context 认证上下文
     */
    default void onSuccess(IAuthenticationToken authenticationToken, AuthenticationContext context) {}

    /**
     * 认证失败触发
     * 
     * @param authenticationToken 认证token
     * @param context 认证上下文
     */
    default void onFailure(IAuthenticationToken authenticationToken, AuthenticationContext context) {}

    /**
     * 认证过程中出现异常触发
     * 
     * @param authenticationToken 认证token
     * @param context 认证上下文
     * @param exception 异常
     */
    default void onException(IAuthenticationToken authenticationToken, AuthenticationContext context, Exception exception) {}

}
